<?php

namespace IMT\Plugins\CommentsBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;


class DefaultController extends Controller
{
    
    public function indexAction($name)
    {
        return $this->forward('IMTPluginsCommentsBundle:Default:show', array(
        	'idEvent' => 0
    	));
    }
    
    public function showAction($idEvent, $type)
    {
    	$emEvent = $this->container->get('imt_event.'.$type.'_manager');
    	 
    	if($idEvent == 0){
    		$event = $emEvent->createEvent();
    	} else {
    		$event = $emEvent->findEventBy(array('id' => $idEvent));
    		 
    		if(!$event)
    			throw $this->createNotFoundException('L\'événement recherché n\'existe pas');
    	}    	 
    	 
    	return $this->render('IMTPluginsCommentsBundle:Default:index.html.twig');
    }
}
